/**
 * Author(s): xuming.Wong <xuming.Wong@gmail.com>
 */
#include "AnimDataDbc.h"

#include "NativeFile.h"

namespace PQGameCore
{
	const std::string AnimDataDbc::PATH="dbc/AnimationData.dbc";

	AnimDataDbc::AnimDataDbc()
	{
		PQEngine::FileBase* file=new PQEngine::NativeFile(PATH);
		_dbc=new WOWDbcFile(file);
		delete file;
		assert(_dbc);
	}

	ChrAnimDataRecord *AnimDataDbc::getRecord(int id)
	{
		int cnt=_dbc->getRecordCount();
		for(int i=0;i<cnt;i++){
			int recordId=_dbc->getUIntField(i,0);

			if(recordId==id){
				ChrAnimDataRecord *record=(ChrAnimDataRecord*)_dbc->getRecordData(i);
				return record;
			}
		}
		return 0;

	}

}

